<!--
 * @FilePath     : /study_code/jquery/plugin-jquery-tmpl-template.html
 * @Description  : $.template() 编译模板缓存
 * @Date         : 2025-04-21 14:05:03
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-21 14:28:05
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
  </head>
  <body>
    <div id="box"></div>

    <script src="/jquery/dist/jquery.min.js"></script>
    <!-- <script src="/jquery.tmpl/index.js"></script> -->
    <script src="/jquery/plugins/jquery.tmpl/lib/jquery.tmpl.min.js"></script>

    <script>
      $(function () {
        var markup = '<tr>< td > ${ID}</><td>${Name}</td></tr > '
        var users = [
          { ID: 'think8848', Name: 'Joseph Chan' },
          { ID: 'aCloud', Name: 'Mary Cheung' },
        ]

        // 编译一个模板缓存
        $.template('template', markup)

        // 使用编译的模板缓存
        $.tmpl('template', users).appendTo('#box')
      })
    </script>
  </body>
</html>
